import { ipcRenderer } from "electron";
import { useLoading } from "./loading";
import { startServer } from "./server";
import { startWatch, stopWatch } from "./watch";

const { appendLoading, removeLoading } = useLoading();
// domReady().then(appendLoading);

window.onmessage = (ev) => {
  ev.data === "removeLoading" && removeLoading();
  ev.data === "startWatch" && startWatch();
  ev.data === "stopWatch" && stopWatch();
};

ipcRenderer.invoke("getIconfontPath").then((res) => {
  window.myAPI = {
    iconfont: res,
  };
});

startServer();
